package com.reader.cms.entity.sys;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.baomidou.mybatisplus.enums.IdType;
import java.util.Date;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.activerecord.Model;
import com.reader.core.validator.group.AddGroup;
import com.reader.core.validator.group.UpdateGroup;
import org.springframework.format.annotation.DateTimeFormat;

import javax.validation.constraints.NotBlank;
import java.io.Serializable;
import java.util.List;
import java.util.Map;

/**
 * <p>
 * 
 * </p>
 *
 * @author jiahaikun
 * @since 2018-06-27
 */
@TableName("sys_user")
public class SysUser extends Model<SysUser> {

    private static final long serialVersionUID = 1L;

    /**
     * 用户ID
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Integer id;
    /**
     * 登录ID
     */
    @NotBlank(message="登录名不能为空！！！", groups = {AddGroup.class, UpdateGroup.class})
    @TableField("login_id")
    private String loginId;
    /**
     * 密码
     */
    @NotBlank(message="密码不能为空！！！", groups = AddGroup.class)
    private String password;

    private String name;
    private  String phone;
    private String sex;

    @TableField("tenant_id")
    private String tenantId;
    @TableField("organization_id")
    private String organizationId;
    /**
     * 邮箱
     */
    private String email;
    /**
     * 手机号
     */
    private String mobile;
    /**
     *  状态（N：禁用  , Y：可用）
     */
    private Integer enable;
    /**
     *  状态（N： 不删除 , Y：删除）
     */
    @TableField("del_flag")
    private Integer delFlag;
    /**
     * 记录插入时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @TableField("insert_dt")
    private Date insertDt;
    /**
     * 记录插入ID
     */
    @TableField("insert_user_id")
    private Integer insertUserId;
    /**
     * 记录修改时间
     */
    @DateTimeFormat(pattern = "yyyy-MM-dd")
    @TableField("updt_dt")
    private Date updtDt;
    /**
     * 记录修改ID
     */
    @TableField("updt_user_id")
    private Integer updtUserId;
    /**
     * 备注
     */
    private String remark;
    @TableField("invite_code")
    private String inviteCode;
    private String avatar;
    /**
     * 用户所拥有的所有角色代码
     */
    @TableField(exist = false)
    private List<String> rolesId;

    /**
     * 用户所拥有的所有角色名称
     */
    @TableField(exist = false)
    private  List<String> rolesName;
    /**
     * 用户所属组织机构名称
     */
    @TableField(exist = false)
    private String organizeName;

    /**
     * 用户所拥有的所有角色名称
     */
    @TableField(exist = false)
    private  List<Map<String, String>> permissions;

    /**
     * 用户可访问菜单列表
     */
    @TableField(exist = false)
    private List<SysMenu> menus;

    @TableField(exist = false)
    private String roleNames;

    public List<SysMenu> getMenus() {
        return menus;
    }

    public void setMenus(List<SysMenu> menus) {
        this.menus = menus;
    }



    public List<String> getRolesId() {
        return rolesId;
    }

    public void setRolesId(List<String> rolesId) {
        this.rolesId = rolesId;
    }

    public List<String> getRolesName() {
        return rolesName;
    }

    public void setRolesName(List<String> rolesName) {
        this.rolesName = rolesName;
    }

    public List<Map<String, String>> getPermissions() {
        return permissions;
    }

    public void setPermissions(List<Map<String, String>> permissions) {
        this.permissions = permissions;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getLoginId() {
        return loginId;
    }

    public void setLoginId(String loginId) {
        this.loginId = loginId;
    }


    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String tenantId) {
        this.tenantId = tenantId;
    }

    public String getOrganizationId() {
        return organizationId;
    }

    public void setOrganizationId(String organizationId) {
        this.organizationId = organizationId;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public String getMobile() {
        return mobile;
    }

    public void setMobile(String mobile) {
        this.mobile = mobile;
    }

    public Integer  getEnable() {
        return enable;
    }

    public void setEnable(Integer enable) {
        this.enable = enable;
    }

    public Integer getDelFlag() {
        return delFlag;
    }

    public void setDelFlag(Integer delFlag) {
        this.delFlag = delFlag;
    }

    public Date getInsertDt() {
        return insertDt;
    }

    public void setInsertDt(Date insertDt) {
        this.insertDt = insertDt;
    }

    public Integer getInsertUserId() {
        return insertUserId;
    }

    public void setInsertUserId(Integer insertUserId) {
        this.insertUserId = insertUserId;
    }

    public Date getUpdtDt() {
        return updtDt;
    }

    public void setUpdtDt(Date updtDt) {
        this.updtDt = updtDt;
    }

    public Integer getUpdtUserId() {
        return updtUserId;
    }

    public void setUpdtUserId(Integer updtUserId) {
        this.updtUserId = updtUserId;
    }

    public String getRemark() {
        return remark;
    }

    public void setRemark(String remark) {
        this.remark = remark;
    }

    public String getInviteCode() {
        return inviteCode;
    }

    public void setInviteCode(String inviteCode) {
        this.inviteCode = inviteCode;
    }
    public String getAvatar() {
        return avatar;
    }

    public void setAvatar(String avatar) {
        this.avatar = avatar;
    }
    public String getPassword() {
        return password;
    }

    public void setPassword(String password) {
        this.password = password;
    }

    public String getOrganizeName() {
        return organizeName;
    }

    public void setOrganizeName(String organizeName) {
        this.organizeName = organizeName;
    }

    public String getRoleNames() {
        return roleNames;
    }

    public void setRoleNames(String roleNames) {
        this.roleNames = roleNames;
    }

    @Override
    protected Serializable pkVal() {
        return this.id;
    }


    @Override
    public String toString() {
        return "SysUser{" +
        ", id=" + id +
        ", loginId=" + loginId +
        ", password=" + password +
        ", name=" + name +
        ", phone=" + phone +
        ", sex=" + sex +
        ", tenantId=" + tenantId +
        ", organizationId=" + organizationId +
        ", email=" + email +
        ", mobile=" + mobile +
        ", enable=" + enable +
        ", delFlag=" + delFlag +
        ", insertDt=" + insertDt +
        ", insertUserId=" + insertUserId +
        ", updtDt=" + updtDt +
        ", updtUserId=" + updtUserId +
        ", remark=" + remark +
        ", inviteCode=" + inviteCode +
        "}";
    }
}
